home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11586 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: gwen.pcug.co.uk!altheim!broldham
  2. Newsgroups: comp.lang.c
  3. Message-ID: <1258@altheim.win-uk.net>
  4. References: <1239@altheim.win-uk.net><18MAR199607594276@erich.triumf.ca> <1242@altheim.win-uk.net><314EC8E6.216E@ix.netcom.com> <1245@altheim.win-uk.net><31533146.3340333@netline-fddi.jpl.nasa.gov>
  5. Reply-To: broldham@altheim.win-uk.net (Brian R. Oldham)
  6. From: broldham@altheim.win-uk.net (Brian R. Oldham)
  7. Date: Mon, 25 Mar 1996 10:29:28 GMT
  8. Subject: Re: Pointers to register
  9.  
  10. Kevin and Kurt Watzka said roughly the same things so I'll answer them
  11. together... 
  12.  
  13. In article <31533146.3340333@netline-fddi.jpl.nasa.gov>, Kevin Quitt
  14. (kdq@emoryi.jpl.nasa.gov) writes: 
  15. >On Wed, 20 Mar 1996 17:51:39 GMT, broldham@altheim.win-uk.net 
  16. (Brian R. Oldham) wrote:  
  17. >
  18. >>So back to my original question: why does the ostensibly incorrect
  19. >>declaration: 
  20. >>
  21. >>    *ptr = union_member_var;
  22. >>    
  23. >>work, and the correct:
  24. >>
  25. >>    ptr = &union_member_var;
  26. >>    
  27. >>does not?
  28. >
  29. >First of all, it's because they're not declarations, they're statements.  
  30.  
  31. Phew! this is such hard work. So they are statements and not
  32. declarations (y'have to be so careful here <grumble> ) 
  33.  
  34. >Secondly, they mean very different things.  The former says "Take the
  35. >data in union_member_var and store it (starting) in the location whose
  36. >address is in ptr"; the latter says "Take the address of the variable
  37. >union_member_var and put it in the variable called ptr".  
  38.  
  39. So if the former is correct, then can I take it that the assignment of
  40. the pointer is done by the function parameters at the time of calling
  41. this function? 
  42.  
  43.  
  44. ---
  45. Brian Oldham
  46. Hucknall UK
  47. !...Gesundbrunnen
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.